home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-13 | 3.4 KB | 72 lines | [TEXT/MPS ] |
- DTS sample RAM disk. Originally by Gordon Sheridan. Updated by Jim Luther.
- Metrowerks conversion by Brian Bechtel, DTS 940519 at the WWDC (Thanks to
- the Metrowerks coding lab.)
-
- This sample is a control panel, which installs a RAM disk. Under Metrowerks
- and Symantec, this sample is completely in C.
-
- How I converted this program from MPW to Metrowerks.
-
- • Added a main() routine to the driver to handle Metrowerks' startup code.
- • Cleaned up various errors or warnings where Metrowerks was tighter than
- MPW or Symantec.
- • Created a project file for the control panel. This project creates a
- code resource of type cdev, id -4064, which is a control panel. This
- project file is '3RamCDEV.µ'.
- • I built the resource file, and named it '3RamCDEV.µ.rsrc'. This ensures
- that the resources will be automatically included when you build the
- control panel.
- • Created a project file for the DRVR. This project is a code resource
- of type DRVR, id 48, which is the driver itself. Set the project so
- that the DRVR resource is merged into '3RamCDEV.µ.rsrc'.
- • Created a project file for the INIT. This project is a code resource
- of type INIT, id 0, which will install the driver. Set the project so
- that the INIT resource is merged into '3RamCDEV.µ.rsrc'.
- • I had to change the code slightly, because this driver was using some
- low memory globals directly. I now handle low memory accesses by using
- accessor functions. There was one problem; UnitNTryCnt was not defined.
- I created my own accessor functions for this low memory global. This is
- fixed in the Universal Headers starting with ETO 15.
- • Recalculate BufPtr from the low memory global.
-
- There is no way to set the driver flags in the driver header. You have to either
- use ResEdit to change them to the desired values, or set them explicitly in the
- driver. This sample driver sets the flags directly, in the DRVROpen() routine.
-
- Build Order
-
- The control panel consists of four parts: various resources needed to run, plus
- an 'INIT' to load the driver, a 'DRVR' which is the driver itself, and a 'cdev'
- which is the user interface for setting up the driver.
-
- If you are using the .r file, use MPW or SARez to build the resource file
- RamCDev.µ.rsrc. All three projects assume the existence of 3RamCDev.µ.rsrc
-
- Build the project 1RamINIT.µ. This will add an 'INIT' resource to 3RamCDev.µ.rsrc.
-
- Build the project 2RamDRVR.µ. This will add a 'DRVR' resource to 3RamCDev.µ.rsrc.
-
- Build the project 3RamCDEV.µ. This will create a control panel containing the
- 'INIT', 'DRVR', and 'cdev' resources necessary to run this control panel.
-
- You can use the AppleScript provided to build either the Metrowerks or Symantec
- versions of this RAMDisk.
-
- Known errors in Metrowerks:
-
- MW C/C++ 68K 1.0 & earlier: The driver name ".RamDRVR" is put into the driver as
- {09}{00}.RamDRVR. I had to change this to {08}.RamDRVR{00} to be correct. This
- is what it should have generated. Use ResEdit. This is fixed in MW C/C++ 68K
- 1.0.1.
-
- Version History:
-
- 1.0 First release
-
- 1.1 In the file RAMInit.c, in the procedure GrowUnitTable(), there was a line which
- read:
- newUnitTableBase = NewPtrSysClear(sizeof(newUnitEntryCount * sizeof(long)));
- this line should be
- newUnitTableBase = NewPtrSysClear(newUnitEntryCount * sizeof(long));
- Because of this bug, trying to grow the unit table will overwrite other parts of the
- system heap and potentially crash. Thanks to Mike Wiese for finding this bug.